<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul id="ul1">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
    <input type="button" value="删除" id="delete">
    <input type="button" value="克隆" id="copy">

    <script>
        //单击删除按钮，删除无序列表中第一个
        var del=document.querySelector('#delete');
        del.onclick=function(){
            var ul=document.querySelector('#ul1');
            //有子节点，可删除
            if(ul.children.length>0){
                // confirm弹出确认对话框
                if(confirm('确定删除？')){
                    ul.removeChild(ul.firstElementChild);
                }              
            }
        }

        document.querySelector('#copy').onclick=function(){
            //复制删除按钮，并放在自己后面
            var src=document.querySelector('#delete');
            var cp=src.cloneNode(true);
            this.parentNode.appendChild(cp);
        }
    </script>
</body>
</html>